package com.ljy.my_study.java.thread.jointest;

public class TestMain {

    public static void main(String[] args) {

        Thread t1=new Thread(()->{
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            print();
        });
        Thread t2=new Thread(()->{
            try {
                t1.join();
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            print();
        });
        Thread t3=new Thread(()->{
            try {
                t2.join();
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            print();
        });
        t3.start();
        t2.start();
        t1.start();

    }


    private static void print(){
        System.out.println(Thread.currentThread().getName()+" execute.");
    }
}
